/**
 * 
 */

/**
 * @author yaoshen.yu.128@gmail.com
 *
 */
import java.util.*;

public class Example2_7 {
	public static void main (String args[]) {
		int [] a = {12,34,9,23,45,6,45,90,123,19,34};
		Arrays.sort(a);
		System.out.println(Arrays.toString(a));
		int number;
		System.out.println("请输入需要查找的数字");
		Scanner reader = new Scanner(System.in);
		number = reader.nextInt();
		int index = Arrays.binarySearch(a, number);
		if (index>=0) {
			System.out.println(number + "和数组中索引为" + index +"的元素值相同");
		}
		else {
			System.out.println(number + "不与数组中任何元素值相同");
		}
	}
}
